<template>
  <div>
    <a-modal v-model:visible="pageData.visible" width="60%" :title="pageData.title">
      <template #footer>
        <a-button @click="pageData.visible = false">关闭</a-button>
      </template>
      <a-form class="autoee-detail-page" ref="postDetailFormRef" name="postDetailForm" :model="postDetailForm.data" :labelCol="{ span: 8 }" :wrapperCol="{ span: 14 }">
        <a-row :gutter="24">
          <a-col span="12">
            <a-form-item name="postName" label="用户账号">
              <span>{{ postDetailForm.data.postName }}</span>
            </a-form-item>
          </a-col>
        <a-col span="12">
          <a-form-item name="postCode" label="岗位编码">
            <span>{{ postDetailForm.data.postCode }}</span>
            </a-form-item>
          </a-col>
        <a-col span="12">
          <a-form-item name="postName" label="岗位名称">
            <span>{{ postDetailForm.data.postName }}</span>
            </a-form-item>
          </a-col>
        <a-col span="12">
          <a-form-item name="postSort" label="显示顺序">
            <span>{{ postDetailForm.data.postSort }}</span>
            </a-form-item>
          </a-col>
        <a-col span="12">
          <a-form-item name="status" label="岗位状态">
              <span>{{ AutoeeUtil.getDictLabelByKey(postDetailForm.data.status, fatherPageData.sysNormalDisableDict) }}</span>
            </a-form-item>
          </a-col>
        <a-col span="12">
          <a-form-item name="remark" label="备注">
          <span>{{ postDetailForm.data.remark }}</span>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-modal>
  </div>
</template>

<script setup>
import { getPost } from "@/api/system/post";
import { reactive, ref } from 'vue';
import AutoeeUtil from '@/utils/AutoeeUtil.js';

// 父页面公用数据
const fatherPageData = defineProps({
  sysNormalDisableDict: Array,
});

// 当前页面使用的数据
const pageData = reactive({
  title: '详细页面',
  visible: false,
  operateType: '',
});

//详细Form
const postDetailFormRef = ref();
const postDetailForm = reactive({ data: {} });
// 打开详细窗口
const openModal = (record) => {
  getPost(record.postId).then((response) => {
    postDetailForm.data = response.data;
    pageData.visible = true;
  });
};

// 对外暴露出去
defineExpose({
  openModal,
});
</script>

<style lang="less"></style>
